﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ISRecord.View
{
    /// <summary>
    /// Interaction logic for MessageDialog.xaml
    /// </summary>
    public partial class MessageDialog : Window
    {
        private readonly bool askingQuestion;
        private MessageDialog()
        {
            InitializeComponent();
        }
        public MessageDialog(string message, bool askingQuestion)
            : this()
        {
            this.askingQuestion = askingQuestion;
            SetMessageToContent(message);
        }

        private void SetMessageToContent(string s)
        {
            this.message.DataContext = s;
        }

        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!askingQuestion)
            {
                btnCancel.Visibility = Visibility.Hidden;
            }
        }
    }
}
